import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        area:'',
        token: '',
        userInfo: {
          username: '匿名登录',
          role:false
        }


    },
    mutations: {
        setToken (state, token) {
            state.token = token
          },
          setUserInfo (state, userInfo) {
            state.userInfo = userInfo
          }
          ,
          
        setarea(state, info) {
            localStorage.setItem("area", info);
            state.area = info;
        },
        
    },
    actions: {},
    modules: {},
    getters: {
        getUserInfo(state) {
            return state.userInfo;
        }
    }
})
